import input from './input';

var inputDate = function (options) {
    this.readOnlyMark = $('<div style="position: absolute; top:0; left:0; width:100%; height:100%; display:none;"></div>');
    options.onReadonly = (type) => {
        if (type) {
            this.readOnlyMark.show();
        } else {
            this.readOnlyMark.hide();
        }
    };
    this.element = new input(options);
    this.html = this.element.html;
    var layDataOption = options.layDataOption || {};
    layDataOption.elem = this.html[0];
    layui.laydate.render(layDataOption);
    setTimeout(() => {
        this.html.after(this.readOnlyMark);
    }, 20);
};

inputDate.prototype.set = function (data, doChange) {
    this.element.set.call(this.element, data, doChange);
};

inputDate.prototype.get = function (callBack, ignore) {
    this.element.get.call(this.element, callBack, ignore);
};

inputDate.prototype.clear = function () {
    this.element.clear();
};
inputDate.prototype.readonly = function (type) {
    this.element.readonly(type);
};

export default inputDate

